package main

func carPooling(trips [][]int, capacity int) bool {

	arr := make([]int, 1005)

	for _, trip := range trips {
		left := trip[1]
		right := trip[2]
		num := trip[0]

		for i := left; i < right; i++ {
			arr[i] += num
		}
	}

	for i := 0; i < len(arr); i++ {
		if arr[i] > capacity {
			return false
		}
	}

	return true
}
